$(function () {
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('middle_rwqs'));
    // 指定图表的配置项和数据
    var option = {
        title: {
            text: '近7天的任务趋势'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        legend: {
            data: ['未开始', '进行中', '已完成', '已暂停', '已取消', '已关闭']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['05-10', '05-11', '05-12', '05-13', '05-14', '05-15', '05-16']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '未开始',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '进行中',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '已完成',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '已暂停',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '已取消',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '已关闭',
                type: 'line',
                stack: '总量',
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        color: '#37a2da'
                    }
                },
                itemStyle: {
                    normal: {
                        color: '#fb7293',
                        lineStyle: {
                            color: '#fb7293'
                        }
                    }
                },
                data: [0, 0, 0, 0, 0, 0, 0]
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    // 基于准备好的dom，初始化echarts实例
    var myCharts = echarts.init(document.getElementById('footer_rwqs'));
    // 指定图表的配置项和数据
    var options = {
        title: {
            text: '近7天的Bug趋势'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        legend: {
            data: ['设计如此', '重复Bug', '外部原因', '已解决', '无法重现', '延期处理', '不予解决']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['05-10', '05-11', '05-12', '05-13', '05-14', '05-15', '05-16']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '设计如此',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '重复Bug',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '外部原因',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '已解决',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '无法重现',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '延期处理',
                type: 'line',
                stack: '总量',
                data: [0, 0, 0, 0, 0, 0, 0]
            },
            {
                name: '不予解决',
                type: 'line',
                stack: '总量',
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        color: '#ffe693'
                    }
                },
                itemStyle: {
                    normal: {
                        color: '#e7bcf3',
                        lineStyle: {
                            color: '#e7bcf3'
                        }
                    }
                },
                data: [0, 0, 0, 0, 0, 0, 0]
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myCharts.setOption(options);

    // 删除
    $('.delete').on('click',function(){
        let id = $(this).data('id')
        $.ajax({
            type: 'get',
            url: '/deleteUser',
            data: {id:id},
            beforeSend: function() {
                let flag = confirm('您确定要删除该项目???')
                if(!flag) {
                    return false
                }
            },
            success: function(data) {
                if(data.code == '1002') {
                    alert(data.message)
                    location.href = '/mange'
                }
            }
        })
    })
    
   

})